package com.huan.quartz.job.impl;

import com.huan.quartz.job.AbstractMutexJob;
import com.huan.quartz.quartz.SpringApplicationContext;
import com.huan.quartz.service.QuartzJobCfgService;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * 测试互斥任务
 *
 * @author huan.fu
 * @date 2018/9/11 - 14:04
 */
@Slf4j
public class DemoMutexJob002 extends AbstractMutexJob {

	@Override
	public void doExecute(String workDate) {
		log.info("测试demoMutexJob002开始执行...");
		try {
			TimeUnit.SECONDS.sleep(20);
		} catch (InterruptedException e) {
			log.error(e.getMessage(), e);
			Thread.currentThread().interrupt();
		}
		SpringApplicationContext.getBean(QuartzJobCfgService.class).queryAllEnableJobCfgs().forEach(System.out::println);
		log.info("测试demoMutexJob002结束执行...");
	}
}
